package com.lagou.edu.servlet;

import com.lagou.edu.request.Request;
import com.lagou.edu.response.Response;

import java.io.IOException;

/**
 * @author 赵虎
 * @date 2020/11/8 10:03 下午
 */
public abstract class HttpServlet implements Servlet {

    public abstract void doGet(Request request, Response response) throws IOException;

    public abstract void doPost(Request request, Response response) throws IOException;

    @Override
    public void service(Request request, Response response) throws Exception {
        if ("GET".equals(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
